package base.regex;

public class IpCheck {
    public static void main(String[] args) {
        String regex = "^(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$";
        String text = "199.255.254.25";
        if(text.matches(regex)){
            System.out.println("the ip is right");
        }else {
            System.out.println("the ip is false");
        }
    }
}
